import java.util.HashSet;
import java.util.Set;

public class Solution {
    public int distributeCandies(int[] candyType) {
        Set<Integer> set = new HashSet<Integer>();
        for (int candy : candyType) {
            set.add(candy);
        }
        return Math.min(set.size(), candyType.length / 2);
    }

    public static void main(String[] args) {
        Solution solution = new Solution();
        // 糖果种类数大于可吃数量
        int[] candyType1 = {1, 1, 2, 2, 3, 3};
        System.out.println(java.util.Arrays.toString(candyType1));
        System.out.println(solution.distributeCandies(candyType1)); // 输出 3
    }
}